home *** CD-ROM | disk | FTP | other *** search
- 'Sys(800) = 1 ' +++++++ Turn on Tracing Dialog
-
- nSelEntity = sys(80)
-
- if nSelEntity < 1 then
- Message "Please select objects before running this program"
- end
- endif
-
- SETPOINT "Set points: 1-Lower Left, 2-Lower Right, 3-Upper Left, 4-Upper Right", 4
- if sys(1) < 4 then
- Message "Four points are needed to complete the command."
- end
- endif
-
- POINTVAL Qx, Qy, Qz, 3
- POINTVAL Rx, Ry, Rz, 4
- POINTVAL Sx, Sy, Sz, 2
- POINTVAL Tx, Ty, Tz, 1
-
- sys(36) = 1
-
- >VectorConvert
- {
- }
-
- minX = sys(196)
- minY = sys(197)
- maxX = sys(198)
- maxY = sys(199)
-
- Ax = minX
- Ay = maxY
-
- Bx = maxX
- By = maxY
-
- Cx = maxX
- Cy = minY
-
- Dx = minX
- Dy = minY
-
- dim x(400), y(400), z(400)
-
- nSelEntity = sys(80)
-
- for i = 1 to nSelEntity
- GetSelect i, k
- Entity k
-
- if sys(90) = 1 then
- npts = sys(99)
- for j = 1 to npts
- PointVal x(j), y(j), z(j), j
- ratio1 = (x(j) - Dx) / (Cx - Dx)
- ratio2 = (y(j) - Dy) / (Ay - Dy)
-
- pTSx = Tx + ratio1*(Sx-Tx)
- pTSy = Ty + ratio1*(Sy-Ty)
- pTSz = Tz + ratio1*(Sz-Tz)
-
- pQRx = Qx + ratio1*(Rx-Qx)
- pQRy = Qy + ratio1*(Ry-Qy)
- pQRz = Qz + ratio1*(Rz-Qz)
-
- pTQx = Tx +ratio2*(Qx-Tx)
- pTQy = Ty +ratio2*(Qy-Ty)
- pTQz = Tz +ratio2*(Qz-Tz)
-
- pSRx = Sx + ratio2*(Rx-Sx)
- pSRy = Sy + ratio2*(Ry-Sy)
- pSRz = Sz + ratio2*(Rz-Sz)
-
- b = ((pSRy-pTQy)*(pTQx-pTSx)-(pSRx-pTQx)*(pTQy-pTSy))/((pSRy-pTQy)*(pQRx-pTSx)-(pSRx-pTQx)*(pQRy-pTSy))
-
- x(j) = pTSx + b*(pQRx-pTSx)
- y(j) = pTSy + b*(pQRy-pTSy)
- z(j) = pTSz + b*(pQRz-pTSz)
- next
-
- ir = sys(290)
- ig = sys(291)
- ib = sys(292)
- lay = sys(93)
- ltype = sys(91)
- dscale = sys(97)
- bold = sys(98)
-
- >Line
- {
- <Color [ir, ig, ib]
- <Layer [lay]
- <LineStyle [ltype, dscale, bold]
-
- for j = 1 to npts
- <PointXYZ [x(j), y(j), z(j)]
- next
- }
- endif
-
- next
-
- >SelectDelete
- {
- }
-
- >Regenerate
- {
- }
-
- sys(36) = 0
-